#pragma once

#include <string>
// Class for Inter Process Communication using Memory Mapped Files
class CIPC
{
public:

	CIPC();
	virtual ~CIPC();

public:
	bool CreateIPCMMF(void);
	bool OpenIPCMMF(void);
	void CloseIPCMMF(void);

	bool IsOpen(void) const {return (m_hFileMap != NULL);}

	bool ReadIPCMMF(LPBYTE pBuf, DWORD &dwBufSize);
	bool WriteIPCMMF(const LPBYTE pBuf, const DWORD dwBufSize);

	bool Lock(void);
	void Unlock(void);

private:
	HANDLE m_hFileMap;
	HANDLE m_hMutex;

	static std::string g_szIPCSharedMMF ;
	static std::string g_szIPCMutex ;
};
